import request from '@/utils-shop/request'

// api地址
const api = {
  list: 'goods/list',
  add: 'goods/add',
  edit: 'goods/edit',
  detail: 'goods/detail',
  searchNo: 'goods/searchNo',
  getCodeInfo: 'goods/getCodeInfo'
}

// 商品列表
export const list = param => {
  return request.get(api.list, param)
}

// 商品详情
export const detail = goodsId => {
  return request.get(api.detail, { goodsId })
}

// 商品添加
export const add = param => {
  return request.post(api.add, param)
}

// 商品添加
export const edit = (goodsId, data) => {
  return request.post(api.edit, {goodsId, form:data})
}

// 商品添加
export const getCodeInfo = (content) => {
  return request.post(api.getCodeInfo, { content })
}

// 商品详情
export const searchNo = goodsNo => {
  return request.get(api.searchNo, { goodsNo })
}
